package com.gitee.cashzhang27.test.cloud.oauth.auth.server.redis.service.impl;

import com.gitee.cashzhang27.test.cloud.oauth.auth.server.redis.entity.UserDetails;
import com.gitee.cashzhang27.test.cloud.oauth.auth.server.redis.service.AuthUserDetailsService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * @author Cash Zhang
 * @version v1.0
 * @since 2019/02/07 21:24
 */
@Slf4j
@Service
@AllArgsConstructor
public class AuthUserDetailsServiceImpl implements AuthUserDetailsService {

//  private UserFeign userFeign;

  @Override
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {

    return UserDetails
        .builder()
        .id("1").username(username)
        .password("$2a$10$o4rEubZWoDRz0XqtXOKK9uhRRb9eo6On5lpekJ5EpC5Et9BLMbdwW").roleId("1")
        .build();
//    return userFeign.getUser(username);
  }
}
